home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1 / Nebula One.iso / Graphics / Plotting / aa_Intel_Only / Gnuplot / Unused / corplot.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-06-12  |  2.1 KB  |  85 lines

  1. #ifndef lint
  2. static char *RCSid = "$Id: corplot.c,v 3.37 1992/05/28 03:31:19 woo Exp $";
  3. #endif
  4.  
  5.  
  6. /* GNUPLOT - corplot.c */
  7. /*
  8.  * Copyright (C) 1986 - 1993   Thomas Williams, Colin Kelley
  9.  *
  10.  * Permission to use, copy, and distribute this software and its
  11.  * documentation for any purpose with or without fee is hereby granted, 
  12.  * provided that the above copyright notice appear in all copies and 
  13.  * that both that copyright notice and this permission notice appear 
  14.  * in supporting documentation.
  15.  *
  16.  * Permission to modify the software is granted, but not the right to
  17.  * distribute the modified code.  Modifications are to be distributed 
  18.  * as patches to released version.
  19.  *  
  20.  * This software is provided "as is" without express or implied warranty.
  21.  * 
  22.  *
  23.  * AUTHORS
  24.  * 
  25.  *   Original Software:
  26.  *     Thomas Williams,  Colin Kelley.
  27.  * 
  28.  *   Gnuplot 2.0 additions:
  29.  *       Russell Lang, Dave Kotz, John Campbell.
  30.  *
  31.  *   Gnuplot 3.0 additions:
  32.  *       Gershon Elber and many others.
  33.  * 
  34.  * Send your comments or suggestions to 
  35.  *  info-gnuplot@dartmouth.edu.
  36.  * This is a mailing list; to join it send a note to 
  37.  *  info-gnuplot-request@dartmouth.edu.  
  38.  * Send bug reports to
  39.  *  bug-gnuplot@dartmouth.edu.
  40.  */
  41. #include <stdio.h>
  42. #include <process.h>
  43. #include <dos.h>
  44. #if defined(ATARI) && defined(__PUREC__)
  45. #include <plot.h>
  46. #endif
  47.  
  48. #define BOUNDARY 32768
  49. #define segment(addr) (FP_SEG(m) + ((FP_OFF(m)+15) >> 4));
  50. #define round(value,boundary) (((value) + (boundary) - 1) & ~((boundary) - 1))
  51.  
  52. char *malloc(),*realloc();
  53.  
  54. char prog[] = "gnuplot";
  55. char corscreen[] = "CORSCREEN=0";
  56.  
  57. main()
  58. {
  59. register unsigned int segm,start;
  60. char *m;
  61.     if (!(m = malloc(BOUNDARY))) {
  62.         printf("malloc() failed\n");
  63.         exit(1);
  64.     }
  65.     segm = segment(m);
  66.     start = round(segm,BOUNDARY/16);
  67.  
  68.     if (realloc(m,BOUNDARY+(start-segm)*16) != m) {
  69.         printf("can't realloc() memory\n");
  70.         exit(2);
  71.     }
  72.  
  73.     if ((segm = start >> 11) >= 8) {
  74.         printf("not enough room in first 256K\n");
  75.         exit(3);
  76.     }
  77.  
  78.     corscreen[sizeof(corscreen)-2] = '0' + segm;
  79.     if (putenv(corscreen))
  80.         perror("putenv");
  81.  
  82.     if (spawnlp(P_WAIT,prog,prog,NULL))
  83.         perror("spawnlp");
  84. }
  85.